package com.es;


import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Arrays;

@Configuration
@ComponentScan
public class JavaConfigApp {
    public static void main(String[] args) {
        //ApplicationContext
        //XmlApplicationContext  读的都是基于xml配置文件的
        AnnotationConfigApplicationContext ctx =  new AnnotationConfigApplicationContext(JavaConfigApp.class);
        //
        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.stream(beanNames).forEach(System.out::println);
        //
        ctx.close();
    }
}
